package com.homelink.android.explorerup.activity;

import java.util.ArrayList;

import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.widget.ListView;

import com.homelink.android.explorerup.R;
import com.homelink.android.explorerup.adapter.FavorListAdapter;
import com.homelink.android.explorerup.db.Bookmark;
import com.homelink.android.explorerup.db.DBUtil;

/**
 * 
 * @author hliang@126.com
 * 
 */
public class FavorActivity extends Activity {
	private ListView listView;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		super.onCreate(savedInstanceState);

		setContentView(R.layout.favor);

		listView = (ListView) findViewById(R.id.favor);

		DBUtil db = new DBUtil(this);
		FavorListAdapter adapter = new FavorListAdapter(this);
		ArrayList<Bookmark> bookmarks = db.select(Bookmark.Types.BOOKMARK);
		ArrayList<Bookmark> history = db.select(Bookmark.Types.MOST_USED);
		adapter.setBookmarList(bookmarks);
		adapter.setHistory(history);

		listView.setAdapter(adapter);

	}
}
